package com.dianban.service.impl;

import com.dianban.dao.StoreGuideDao;
import com.dianban.entity.StoreGuide;
import com.dianban.service.StoreGuideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true)
public class StoreGuideServiceImpl implements StoreGuideService {

    @Autowired
    private StoreGuideDao storeGuideDao;

    @Override
    public StoreGuide findById(Long id) {
        return storeGuideDao.findById(id);
    }

    @Override
    public StoreGuide findByUserId(Long userId) {
        return storeGuideDao.findByUserId(userId);
    }

    @Override
    @Transactional(readOnly = false)
    public void insert(StoreGuide storeGuide) {
        storeGuide.setCreatetime(System.currentTimeMillis()/1000);
        storeGuideDao.insert(storeGuide);
    }

}
